//
//  LiveWebViewController.m
//  LOL_PalmarHelper
//
//  Created by dlios on 15-6-26.
//  Copyright (c) 2015年 hantao. All rights reserved.
//

#import "LiveWebViewController.h"

@interface LiveWebViewController ()

@end

@implementation LiveWebViewController



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
  
    
    self.myWeb = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.myWeb.delegate = self;
    
    NSString *str = self.myurl;
    
    NSURL *url = [NSURL URLWithString:str];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [self.myWeb loadRequest:request];
    
    [self.view addSubview:self.myWeb];
    
    
    //2. 禁用拖拽时的反弹效果
        [(UIScrollView *)[[self.myWeb subviews] objectAtIndex:0] setBounces:NO];
    
    [self.myWeb setScalesPageToFit:YES];     //yes:根据webview自适应，NO：根据内容自适应
    
    
    self.add = 0;
    
 

    
}


-(void)webViewDidStartLoad:(UIWebView *)webView
{
    
  
//       NSLog(@"开始加载");
    
    
}

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
//    NSLog(@"加载完成");
    
  
    
 
 
}

- (void)webView:(UIWebView *)webView  didFailLoadWithError:(NSError *)error //网页加载错误的时候调用
{
//    NSLog(@"%@", error);

    
    
    UIAlertView *aa = [[UIAlertView alloc] initWithTitle:nil message:@"网络不给力" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
    [aa show];
    
 
  
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    

    
    return YES;
    
}




























- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
